/*
    asyframe for asyframe@gmail.com

    Copyright (C) 2011, asyframe@gmail.com, http://asyframe.googlecode.com/

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

namespace asyframe
{
	typedef unsigned char byte;
	typedef unsigned char uint8;
	typedef unsigned short uint16;
	typedef byte uint24[3];
	typedef unsigned int uint32;
	typedef unsigned long long uint64;
	typedef byte uint128[16];

	typedef char int8;
	typedef short int16;
	typedef int8 int24[3];
	typedef int int32;
	typedef long long int64;
	typedef int8 int128[16];

} /* namespace asyframe */

enum CONST_DESCRIPTION
{
	CONST_START																					=-0x3FFFFFFF,

	CONST_ZERO																					=0,

	CONST_END																					=0x3FFFFFFF
};

enum CONST_COMMON
{
	CONST_COMMON_START																			=-10,

	CONST_COMMON_FAIL																			=-1,
	CONST_COMMON_SUCCESS																		=0,


	CONST_COMMON_END																			=10
};

enum ERROR_COMMON
{
	ERROR_COMMON_START																			=-100,

	ERROR_COMMON_SHARED_PTR_NULL																=-101,
	ERROR_COMMON_PTR_NULL																		=-102,
	ERROR_COMMON_ASIO_UNEXPECTED_ERROR															=-103,
	ERROR_COMMON_CONTAINER_SIZE_ERROR															=-104,
	ERROR_COMMON_CONTAINER_ELEMENT_ALREADY_EXIST												=-105,
	ERROR_COMMON_CONTAINER_ELEMENT_NOT_EXIST													=-106,

	ERROR_COMMON_END																			=-200
};

enum INFO_COMMON
{
	INFO_COMMON_START																			=100,

	INFO_COMMON_TIMER_FIRE_EXCEPTION															=101,
	INFO_COMMON_ELEMENT_NOT_FOUND																=102,
	INFO_COMMON_CONTAINER_EMPTY																	=103,
	INFO_COMMON_INDEX_OUTOF_BOUND																=104,

	INFO_COMMON_END																				=200
};

enum INFO_BASE
{
	INFO_BASE_START																				=1000,

	INFO_IACTIONBASE_TIMER_OPERATION_ABORT														=1001,
	INFO_IACTIONBASE_HANDLE_OPERATION_ABORT														=1002,
	INFO_ACTORBASE_CLOSE_ALREADY_CLOSE															=1003,
	INFO_APPBASE_STOP_NOT_STARTED																=1004,
	INFO_STANDALONETHREADHANDLER_HANDLETIMEOUT_TIMER_OPERATION_ABORT							=1005,
	INFO_STANDALONETHREADHANDLER_HANDLETIMEOUT_THREAD_ABORT										=1006,
	INFO_HANDLERBASE_CLOSE_NOT_INIT																=1007,
	INFO_HANDLERBASE_OPERATIONSTART_HANDLER_NOT_START											=1008,
	INFO_HANDLERBASE_START_NOT_INIT																=1009,
	INFO_HANDLERBASE_START_ALREADY_START														=1010,
	INFO_IACTIONBASE_HANDLETIMEOUT_HANDLER_NOT_START											=1011,
	INFO_PACKETELEMENT_READCONTAINERFROMBUFFER_BYTESTOREAD_EXCEED								=1012,
	INFO_BYTESTRANSFERRED_INADEQUATE															=1013,
	INFO_OPAQUE_READELEMENTSFROMOPAQUEDATA_OPAQUEDATA_EMPTY										=1014,
	INFO_DATAHANDLER_IOBUFFER_OUTOF_SPACE														=1015,

	INFO_BASE_END																				=2000
};

enum ERROR_BASE
{
	ERROR_BASE_START																			=-1000,

	ERROR_POST_NO_IOSERVICE																		=-1001,
	ERROR_DISPATCH_NO_IOSERVICE																	=-1002,
	ERROR_HANDLERBASE_INIT_ALREADY_INIT															=-1003,
	ERROR_HANDLERBASE_HANDLEROWNER_NOT_EXIST													=-1004,
	ERROR_ACTORMGRBASE_INIT_ALREADY_START														=-1005,
	ERROR_ACTORMGRBASE_START_ALREADY_START														=-1006,
	ERROR_ACTORMGRBASE_CLOSE_NOT_START															=-1007,
	ERROR_STANDALONETHREADHANDLER_ASYNCSTARTTHREAD_ARG_NULL										=-1008,
	ERROR_STATICTHREADHANDLER_ONTHREADFINISH_UNEXPECTED_ERROR									=-1009,
	ERROR_ASYNCCLOSEACTORMGRHANDLER_ONTHREADFINISH_UNEXPECTED_ERROR								=-1010,
	ERROR_APPBASE_RUN_ALREADY_STARTED															=-1011,
	ERROR_APPBASE_INIT_READ_CONFIG_FAIL															=-1012,
	ERROR_BUFFERPOOL_FREE_POOL_NOT_EXIST														=-1013,
	ERROR_BUFFERPOOL_FREE_POINT_ERROR															=-1014,
	ERROR_PROACCEPTHANDLER_ONACCEPT_UNEXPECTED_ERROR											=-1015,
	ERROR_PACKETELEMENT_BYTES_COMPUTE															=-1016,
	ERROR_NUMERICVARARRAY_WRONG_LENGTH															=-1017,
	ERROR_STRUCTVARARRAY_WRONG_LENGTH															=-1018,
	ERROR_STRUCTVARLIST_WRONG_LENGTH															=-1019,

	ERROR_BASE_END																				=-2000
};

enum INFO_IOBUFFER
{
	INFO_IOBUFFER_START																			=2000,

	INFO_IOBUFFER_CONSUME_SIZE_TOO_SMALL														=2001,
	INFO_IOBUFFER_PRODUCE_SPACE_TOO_SMALL														=2002,
	INFO_IOBUFFER_SEEK_WRONG_OFFSET																=2003,
	INFO_IOBUFFER_READ_SIZE_TOO_SMALL															=2004,
	INFO_IOBUFFER_PEEK_SIZE_TOO_SMALL															=2005,
	INFO_IOBUFFER_NTOHREAD_SIZE_TOO_SMALL														=2006,
	INFO_IOBUFFER_NTOHPEEK_SIZE_TOO_SMALL														=2007,

	INFO_IOBUFFER_END																			=3000
};

enum ERROR_IOBUFFER
{
	ERROR_IOBUFFER_START																		=-2000,

	ERROR_IOBUFFER_RECAPACITY_NOT_IN_WORKER_THREAD												=-2002,

	ERROR_IOBUFFER_END																			=-3000
};
